
list1 = ["ZhangSan", "LiSi", "WangWu", "ZhaoLiu"]

while True:
    inp = input("请输入需要查询的下标(0-3)")
    try:
        if int(inp) == -1:
            print(f"输入的索引{inp}错误，请重新输入")
            continue
        else:
            print(f"查询结果 {inp} : {list1[int(inp)]}")
            break
    except Exception as e:
        print(f"输入的索引{inp}错误，请重新输入")
        continue


list1 = [f"{i} × {j} = {i * j}" for i in range(1, 10) for j in range(i, 10)]

top = 9
count = 1
for i in list1:
    print(f"{i}", end="\t")
    if count == top:
        top -= 1
        count = 1
        print("")
    else:
        count += 1



